// 字体图标
@import '../font/style.css';

// fade 渐变
.fa-widget__fade {
  &-enter-active,
  &-leave-active {
    transition: opacity 0.5s ease-in-out;
  }

  &-enter,
  &-leave-to {
    opacity: 0;
  }
}

/** 加载动画 */
@keyframes fa-loading-animation {
  0% {
    background-position-x: 120%;
  }

  100% {
    background-position-x: -20%;
  }
}

// 链接
.fa-widget-link {
  color: $color-primary;
  font-size: 12px;
  text-decoration: none;
  outline: none;
  cursor: pointer;
  user-select: none;

  &:hover {
    opacity: 0.8;
  }

  &:active {
    opacity: 0.9;
  }
}

// 单选按钮组
.fa-radio-button-group {
  margin: 0 -16px 0 0;
  padding: 0;

  &.is-disabled .fa-radio-button {
    color: $color-text-disabled;
    cursor: not-allowed;

    &.is-active {
      color: $color-primary-light;
    }
  }
}

// 单选按钮
.fa-radio-button {
  $size: 32px;
  display: inline-block;
  width: $size;
  height: $size;
  margin: 0 8px 0 0;
  font-size: 16px;
  line-height: $size;
  text-align: center;
  list-style: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;

  &:last-child {
    margin-right: 0;
  }

  &:hover {
    background-color: $color-primary-lightest;
  }

  &.is-active {
    color: $color-primary;
    background-color: $color-primary-lightest;
  }
}

// 弹出层
.fa-widget-popover {
  $p: 16px;

  &.el-popover {
    box-sizing: border-box;
    padding: $p;
    color: $color-text-primary;
  }

  &__hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    margin-top: -$p;
    color: $color-text-primary;
    font-size: 14px;
  }
}

/** element 控件样式 */
.fa-contract-scope {
  .el-form-item {
    .el-form-item__label {
      position: relative;
      display: flex;
      align-items: center;
      float: none;
      font-size: 12px;
      line-height: 32px;
      text-align: left;
    }

    &.is-required:not(.is-no-asterisk) > .el-form-item__label {
      &::before {
        position: absolute;
        top: 1px;
        left: -10px;
      }
    }
  }

  .el-input__inner,
  .el-textarea__inner {
    font-family: $font-family;
  }

  .el-input {
    &.is-active .el-input__inner,
    &__inner:focus {
      border-color: $color-primary;
    }

    &__inner {
      padding: 0 8px;
    }

    &--prefix .el-input__inner {
      padding-left: 24px;
    }

    &--suffix .el-input__inner {
      padding-right: 24px;
    }

    &__prefix {
      left: 2px;
    }

    &__limit-clearable {
      &:hover .el-input__inner,
      .el-input__inner:focus {
        padding-right: 56px;
      }
    }

    &__suffix {
      top: 2px;
      right: 2px;
      bottom: 2px;
      display: inline-flex;
      align-items: center;
      height: auto;
      background: #fff;
      border-radius: 0 4px 4px 0;

      .el-input__icon {
        font-size: 14px;
        line-height: 24px;
      }

      .el-icon-circle-close:before {
        vertical-align: middle;
        content: '\e79d';
      }
    }

    &.is-disabled .el-input__suffix {
      background: none;
    }

    .el-input__count .el-input__count-inner,
    &__clear {
      height: 24px;
      line-height: 24px;
    }

    &__clear {
      width: 20px;

      ~ .el-input__count .el-input__count-inner {
        padding-left: 0;
      }
    }
  }

  .el-textarea {
    &__inner {
      padding: 4px 8px;
    }

    .el-input__count {
      bottom: 1px;
      line-height: 1.5;
    }
  }

  .el-checkbox {
    &__input {
      &.is-checked:not(.is-disabled) .el-checkbox__inner,
      &.is-indeterminate:not(.is-disabled) .el-checkbox__inner {
        background-color: $color-primary;
        border-color: $color-primary;
      }

      &.is-checked:not(.is-disabled) + .el-checkbox__label {
        color: $color-primary;
      }

      &.is-disabled .el-checkbox__inner::after {
        cursor: unset;
      }
    }

    &__label {
      font-size: 12px;
    }

    &__inner::after {
      left: 3.5px;
      border-width: 2px;
    }

    // 只读状态
    &.is-readonly {
      $border: #c0c0c0;
      .el-checkbox__inner {
        background: #fff;
        border-color: $border;
        cursor: default;

        &:hover {
          border-color: $border;
        }
      }

      &.is-checked .el-checkbox__inner::after {
        border-color: #fff;
      }
    }

    &.is-radio {
      .el-checkbox__inner {
        border-radius: 50%;

        &::after {
          position: absolute;
          top: 50%;
          left: 50%;
          width: 4px;
          height: 4px;
          background: #fff;
          border: none;
          border-radius: 100%;
          transform: translate(-50%, -50%) scale(0);
          transition: transform 0.15s ease-in;
          content: '';
        }
      }

      &.is-checked .el-checkbox__inner::after {
        transform: translate(-50%, -50%) scale(1);
      }
    }
  }

  .el-input-number {
    &.is-controls-right .el-input__inner {
      padding-right: 34px;
      padding-left: 5px;
    }

    &__decrease,
    &__increase {
      &:hover {
        color: $color-primary;

        &:not(.is-disabled) ~ .el-input .el-input__inner:not(.is-disabled) {
          border-color: $color-primary;
        }
      }
    }
  }

  .el-select {
    display: block;

    &-dropdown__item {
      height: 30px;
      font-size: 12px;
      line-height: 30px;

      &.selected {
        color: $color-primary;
      }
    }
  }

  .el-table-column--selection .cell {
    padding-left: 10px;
  }
}
